﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>
#include "slidepage.h"

namespace Ui {
class MainWindow;
}

class QLineEdit;
class CustomIcon;
class textInputItem;
class MyCanvas;
class MainWindow : public QWidget
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

signals:
    void signalSizeChanged(QSize);

protected:
    void resizeEvent(QResizeEvent *event) override;

private:
    void init();
    void initUi();
    void createHeader();
    void createHomePage();

    void settingPageInit();
    void layoutPageInit();
    void aboutPageInit();
    void newPageInit();

    void selectCanvas(MyCanvas *canvas);
    void deleteCanvas(MyCanvas *canvas);

    MyCanvas* loadCanvas(const QString &path);

private:
    Ui::MainWindow *ui;

    QWidget *m_pTitleWidget;
    QWidget *m_pHomePage;

    QLineEdit *m_pCanvasTitle;
    QLineEdit *m_pCanvasDesc;

    CustomIcon *m_pSettingsIcon;
    CustomIcon *m_pLayersIcon;
    CustomIcon *m_pAboutIcon;

    //setting page
    SlidePage *m_pDefaultSettingPage;

    //layout page
    SlidePage *m_pLayersPage;
    singleSelectGroup *layerSel;

    //about page
    SlidePage *m_pSlideAbout;

    //new page
    SlidePage *m_pCreateNewPage;
    textInputItem *rename;
    textInputItem *redescribe;

    textButton *submit;

    MyCanvas *m_pCurCanvas;
    SlidePage *m_pCurSettingsPage;

    QVector<MyCanvas*> canvasList;
};

#endif // MAINWINDOW_H
